package com.asset.dispoal.file.repayment.domain.service.converter;

import com.asset.dispoal.business.repayment.domain.db.entity.BsCaseRepayment;
import com.asset.dispoal.file.repayment.dto.SaveRepaymentInfoRequest;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @description:
 * @author: yf
 * @date: 2022-09-30 14:18:29
 */
@Mapper
public interface RepaymetConverter {
    RepaymetConverter INSTANCE = Mappers.getMapper(RepaymetConverter.class);

    /**
     * 首次转换，现在还的金额表示已还金额
     *
     * @param request
     * @return
     */
    @Mappings({
            @Mapping(target = "id", source = "id")
    })
    BsCaseRepayment resToDo(SaveRepaymentInfoRequest request);

    /**
     * 非首次转换
     *
     * @param request
     * @return
     */
    BsCaseRepayment resToPo(SaveRepaymentInfoRequest request);
}
